package com.bondar.task3;

import java.sql.Connection;

public interface ConnectionPool {
	public static final int IDLE_TIMEOUT = 1_000;
	public static final int WAITING_TIMEOUT = 5_00;
	public static final int N = 3;
	
	/**
	 * Get connection from pool if it is free, otherwise
	 * wait for free connection.
	 * @return Connection
	 * @throws Exception If timeout > WAITING_TIMEOUT
	 */
	public Connection checkOut() throws Exception;
	
	/**
	 * Return connection back to pool.
	 * @param connection
	 */
	public void checkIn(Connection connection);
	
	/**
	 * Close CP
	 */
	public void close();
}
